package com.example.demo.component.proxy.cglib.dispatcher;

import com.example.demo.component.proxy.cglib.lazy.PropertyBean;
import net.sf.cglib.proxy.Enhancer;

/**
 * @ClassName DispatcherBean
 * @Description
 * @date 2023/4/6 14:37
 * @Author yanceysong
 * @Version 1.0
 */
public class DispatcherBean {
    private String name;
    private String value;
    private PropertyBean propertyBean;
    public DispatcherBean(){
        this.name="DispatcherBean";
        this.value="abc";
        this.propertyBean=createDispatcherBean();
    }
    protected PropertyBean createDispatcherBean(){
        Enhancer enhancer=new Enhancer();
        enhancer.setSuperclass(PropertyBean.class);
        return (PropertyBean)enhancer.create(PropertyBean.class,new ConcreteClassDispatcher());
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public PropertyBean getPropertyBean() {
        return propertyBean;
    }

    public void setPropertyBean(PropertyBean propertyBean) {
        this.propertyBean = propertyBean;
    }
}
